#ifndef __API_H__
#define __API_H__

enum API_ID {
    CNTR_CREATE,
    CNTR_ATTACH,
    CNTR_DELETE,
    CNTR_UPDATE,
};

/**
 * @brief: basically identical with cntr_create, command will run in the
 *background
 * @param: command - just a string, don't need to be parsed
 * @return: container id
 **/
int create(const char *image_path, const char *command);
int attach(const int container_id, const char *command);
int delete(const int container_id);

/// update container's cgroup property
/// update_type is the update type of opertation

///  'c' denotes to  update containers' cpu share
///   for example,  update_type='c', update_value=50, means that the max cpu
///   share of container is 50%
///  'm' denotes to update containers's memory usage limit
/// for example, update_type='m', update_value=50 ,means that  the max memory
/// usage is 50MB
///   'n' denotes to update container's  max cpu number to used
///  for example ,update_type='n',update_value=4 ,means that the max cpu number
///  that container can use is 4.

/// return value:
///  0  denotes success
///  -1  denotes  fail with  invalid update_value
///  -2   denotes that update_type is invalid
int update(const int container_id, const char update_type,
           const unsigned int update_value);

#endif // !__API_H__
